﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CSLAGenTool
{
    public class ColumnInfo
    {
        public string columnName = null;
        public bool isNullable = false;
        public string description = null;
        public int stringLength = -1;
        public string variantType = null;
        public string sqlDataType = null;
        public bool isPrimaryKey = false;
        public object defaultValue = null;
        public string decimalLength = null;
        public bool isAutoID = false;
    }

    public class TableInfo
    {
        public string tableName = "";
        public string primaryKey = "";
        public bool isAutoID = false;
        public string variantType = null;
        public string sqlDataType = null;
        public int intLength = 4;
        public List<ColumnInfo> columnInfos = new List<ColumnInfo>();

        public ColumnInfo GetColumnInfo(string columnName)
        {
            foreach (ColumnInfo columnInfo in columnInfos)
            {
                if (columnInfo.columnName == columnName)
                    return columnInfo;
            }
            return null;
        }

        public bool HasColumn(string columnName)
        {
            foreach (ColumnInfo columnInfo in columnInfos)
            {
                if (columnInfo.columnName == columnName)
                    return true;
            }

            return false;
        }
    }
}
